#include "Classes.h"

Sword::Sword() {}
Sword::~Sword() {}
Sword::Sword(Character* pCharacter) {
	Owner = pCharacter;
	Colour = Colour::White;
	SwordType = Owner->GetSwordType();
	Zelda->Objects.push_back(this);
	Owner->AddItem(this);
	isActive = true;
}
void Sword::Act() {
	X = Owner->GetUseItemPosition(this).X;
	Y = Owner->GetUseItemPosition(this).Y;
	Direction = Owner->GetDirection();
	Owner->UseItem(true);
}
void Sword::Draw() {
	SetImageRect();
	s32 width = ImageRect->getWidth() * Zelda->Scale;
	s32 height = ImageRect->getHeight() * Zelda->Scale;
	Zelda->Driver->draw2DImage(Zelda->SpritesSword,rect<s32>(X,Y,X+width,Y+height),*ImageRect,0,0,true);
}
void Sword::SetImageRect() {
	switch (Direction) {
	case East:
		ImageRect = &Zelda->ImageSwordWoodenEast;
		break;
	case North:
		ImageRect = &Zelda->ImageSwordWoodenNorth;
		break;
	case South:
		ImageRect = &Zelda->ImageSwordWoodenSouth;
		break;
	default:
		ImageRect = &Zelda->ImageSwordWoodenWest;
		break;
	}
}